import axiosInstance from "../axiosInstance";
const addressInfo = {
    /**
     * 新增收货地址
     * @param {{ address, phone, person_name, tag }} param0 
     * @returns {Promise<Object>}
     */
    addAddress({ address, phone, person_name, tag }) {
        return axiosInstance.post("/addressInfo/addAddress", {
            address, phone, person_name, tag
        })
    },
    /**
     * 获取收获地址列表
     * @returns {Promise<Object>}
     */
    getMyAddressInfoList() {
        return axiosInstance.get("/addressInfo/getMyAddressInfoList")
    },
    /**
     * 根据id删除当前地址
     * @param {id} id 地址的主键id
     * @returns  {Promise<Object>}
     */
    deleteById(id) {
        return axiosInstance.get("/addressInfo/deleteById", {
            params: {
                id
            }
        })
    },
    /**
     * 根据id获取对应的地址信息
     * @param {number} id 
     * @returns {Promise<Object>}
     */
    findById(id) {
        return axiosInstance.get("/addressInfo/findById", {
            params: {
                id
            }
        })
    },
    /**
     * 修改对应的地址信息
     * @param {{ id, address, phone, person_name, tag }} param0 需要的参数
     * @returns {Promise<Object>}
     */
    update({ id, address, phone, person_name, tag }) {
        return axiosInstance.post("/addressInfo/update", {
            id, address, phone, person_name, tag
        })
    }
}

export default addressInfo;